create or replace function distributor2xml(bigint, text)
returns xml as
$$
	declare
		distributorId alias for $1;
		nameDistributor alias for $2;
	begin
		return 
			xmlelement(
				name distributor, xmlattributes(distributorId as id), 
				xmlelement(name distributorname, nameDistributor)
				)
		;
	end;
$$ language plpgsql immutable; -- same result for same data